import { IParam, EntityBase } from '@/core';
import { IOAUTH_CLIENT_DETAILS } from './interface/i-oauth-client-details';
import OAUTH_CLIENT_DETAILSKeys from './oauth-client-details-keys';

/**
 * oauth客户端信息基类
 * 基于template/src/api/{{appEntities}}/{{appEntities}}-base.ts.hbs生成
 *
 * @export
 * @abstract
 * @class OAUTH_CLIENT_DETAILSBase
 * @extends { EntityBase }
 * @implements { IOAUTH_CLIENT_DETAILS }
 */
export abstract class OAUTH_CLIENT_DETAILSBase
	extends EntityBase
	implements IOAUTH_CLIENT_DETAILS
{
	/**
	 * 实体名称
	 *
	 * @readonly
	 * @type {string}
	 * @memberof OAUTH_CLIENT_DETAILSBase
	 */
	get srfdename(): string {
		return 'OAUTH_CLIENT_DETAILS';
	}

	/**
	 * 当前实体所有属性
	 *
	 * @protected
	 * @type {string[]}
	 * @memberof OAUTH_CLIENT_DETAILSBase
	 */
	protected get keys(): string[] {
		return OAUTH_CLIENT_DETAILSKeys;
	}

	/**
	 * Creates an instance of ConstactOppoBase.
	 * @param {*} [data]
	 * @memberof OAUTH_CLIENT_DETAILSBase
	 */
	constructor(data?: any) {
		super();
		this.setData(data);
	}

	get srfkey(): string {
		return this.client_id;
	}

	set srfkey(val: string) {
		this.client_id = val;
	}

	get srfmajortext(): string {
		return this.client_id;
	}

	set srfmajortext(val: string) {
		this.client_id = val;
	}
	/**
	 * 标识
	 **/
	client_id?: any;

	/**
	 * 名称
	 **/
	client_name?: any;

	/**
	 * 资源id集合
	 **/
	resource_ids?: any;

	/**
	 * 访问密钥
	 **/
	client_secret?: any;

	/**
	 * 权限范围
	 **/
	scope?: any;

	/**
	 * 支持的授权类型
	 **/
	authorized_grant_types?: any;

	/**
	 * 客户端重定向URI
	 **/
	web_server_redirect_uri?: any;

	/**
	 * authorities
	 **/
	authorities?: any;

	/**
	 * access_token_validity
	 **/
	access_token_validity?: any;

	/**
	 * refresh_token_validity
	 **/
	refresh_token_validity?: any;

	/**
	 * 其他信息
	 **/
	additional_information?: any;

	/**
	 * 自动批准授予权限
	 **/
	autoapprove?: any;

	/**
	 * 创建时间
	 **/
	create_time?: any;

	/**
	 * DC
	 **/
	dc?: any;

	/**
	 * 重置实体数据
	 *
	 * @param {IParam} [data={}]
	 * @memberof OAUTH_CLIENT_DETAILSBase
	 */
	reset(data: IParam = {}): void {
		super.reset(data);
		this.client_id = data.client_id || data.srfkey;
		this.client_id = data.client_id || data.srfmajortext;
	}
}
